package com.dgw.springbootstronger.controller;

import com.dgw.springbootstronger.annotation.DonoTime;
import com.dgw.springbootstronger.aop.ArithmeticCalculatorLoggingProxy;
import com.dgw.springbootstronger.aop.Calculator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: springboot-stronger
 * @description:
 * @author: Mr.Dai
 * @create: 2020-03-01 15:05
 **/
@RestController
public class TestController {

    @Autowired
    private ArithmeticCalculatorLoggingProxy arithmeticCalculatorLoggingProxy;

    @Autowired
    private Calculator calculator;

    @GetMapping("test")
    public String test(){
        return arithmeticCalculatorLoggingProxy.getProxy().div(10,2)+"";
    }

    @GetMapping("test2")
    public String test2(){
        return calculator.div(10,2)+"";
    }

    @DonoTime(params = "test3")
    @GetMapping("test3")
    public String test3(){
        return "ok";
    }
}
